FigList[[paste0(r,"Emi_CO2")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Emi_Kyo_Gas")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Pol_Cos_GDP_Los_rat")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Prm_Ene")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Fin_Ene")]]+ theme(legend.position="none")+ggtitle("")
)
ppZ1 <- plot_grid(ppZ0.1,p_legend,ncol=1,rel_heights =c(8,0.5),align = "hv") +
draw_plot_label(label = alphabet[1:9], size = 12,x = c(0,0,0,2/3,2/3,2/3,1/3,1/3,1/3), y = c(1, 2/3,1/3,1, 2/3,1/3,1, 2/3,1/3))
ppZ1
ggsave(ppZ1, file=paste0("../output/4paper/ExtFig",r,".png"), dpi = 250, width=10, height=15,limitsize=FALSE)
ppZ1 <- plot_grid(ppZ0.1,p_legend,ncol=1,rel_heights =c(8,0.25),align = "hv") +
draw_plot_label(label = alphabet[1:9], size = 12,x = c(0,0,0,2/3,2/3,2/3,1/3,1/3,1/3), y = c(1, 2/3,1/3,1, 2/3,1/3,1, 2/3,1/3))
ggsave(ppZ1, file=paste0("../output/4paper/ExtFig",r,".png"), dpi = 250, width=10, height=12,limitsize=FALSE)
ppZ1 <- plot_grid(ppZ0.1,p_legend,ncol=1,rel_heights =c(8,0.25),align = "hv") +
draw_plot_label(label = alphabet[1:9], size = 12,y = c(0,0,0,2/3+0.025,2/3+0.025,2/3+0.025,1/3+0.05,1/3+0.05,1/3+0.05), x = c(1, 2/3,1/3,1, 2/3,1/3,1, 2/3,1/3))
ggsave(ppZ1, file=paste0("../output/4paper/ExtFig",r,".png"), dpi = 250, width=10, height=12,limitsize=FALSE)
ppZ1 <- plot_grid(ppZ0.1,p_legend,ncol=1,rel_heights =c(8,0.25),align = "hv") +
draw_plot_label(label = alphabet[1:9], size = 12,y = c(0,0,0,0.7,0.7,0.7,0.4,0.4,0.4), x = c(1, 2/3,1/3,1, 2/3,1/3,1, 2/3,1/3))
ggsave(ppZ1, file=paste0("../output/4paper/ExtFig",r,".png"), dpi = 250, width=10, height=12,limitsize=FALSE)
ppZ1 <- plot_grid(ppZ0.1,p_legend,ncol=1,rel_heights =c(8,0.25),align = "hv") +
draw_plot_label(label = alphabet[1:9], size = 12,y = c(1,1,1,0.7,0.7,0.7,0.4,0.4,0.4), x = c(1, 2/3,1/3,1, 2/3,1/3,1, 2/3,1/3))
ggsave(ppZ1, file=paste0("../output/4paper/ExtFig",r,".png"), dpi = 250, width=10, height=12,limitsize=FALSE)
ppZ1 <- plot_grid(ppZ0.1,p_legend,ncol=1,rel_heights =c(8,0.25),align = "hv") +
draw_plot_label(label = alphabet[1:9], size = 12,y = c(1,1,1,0.7,0.7,0.7,0.4,0.4,0.4), x = c(0, 1/3,2/3,0, 1/3,2/3,0, 1/3,2/3))
ggsave(ppZ1, file=paste0("../output/4paper/ExtFig",r,".png"), dpi = 250, width=10, height=12,limitsize=FALSE)
ggsave(ppZ1, file=paste0("../output/4paper/ExtFig",r,".png"), dpi = 250, width=12, height=12,limitsize=FALSE)
ppZ1 <- plot_grid(ppZ0.1,p_legend,ncol=1,rel_heights =c(8,0.25),align = "hv") +
draw_plot_label(label = alphabet[1:9], size = 12,y = c(1,1,1,0.69,0.69,0.69,0.38,0.38,0.38), x = c(0, 1/3,2/3,0, 1/3,2/3,0, 1/3,2/3))
ggsave(ppZ1, file=paste0("../output/4paper/ExtFig",r,".png"), dpi = 250, width=12, height=12,limitsize=FALSE)
#X?? Regional Scenarios
for(r in c("World",regionaggset)){
p_legend <- gtable::gtable_filter(ggplotGrob(FigList[[paste0(r,"POP")]]+ theme(legend.position="bottom")), pattern = "guide-box")
ppZ0.1 <- plot_grid(ncol=3,align = "hv",
FigList[[paste0(r,"POP")]] + theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"GDP_per_cap")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"GDP_PPP")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Gini")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Emi_CO2")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Emi_Kyo_Gas")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Pol_Cos_GDP_Los_rat")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Prm_Ene")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Fin_Ene")]]+ theme(legend.position="none")+ggtitle("")
)
ppZ1 <- plot_grid(ppZ0.1,p_legend,ncol=1,rel_heights =c(8,0.25),align = "hv") +
draw_plot_label(label = alphabet[1:9], size = 12,y = c(1,1,1,0.69,0.69,0.69,0.38,0.38,0.38), x = c(0, 1/3,2/3,0, 1/3,2/3,0, 1/3,2/3))
ggsave(ppZ1, file=paste0("../output/4paper/ExtFig",r,".png"), dpi = 250, width=12, height=12,limitsize=FALSE)
}
#X?? Regional Scenarios
for(r in c(regionaggset)){
p_legend <- gtable::gtable_filter(ggplotGrob(FigList[[paste0(r,"POP")]]+ theme(legend.position="bottom")), pattern = "guide-box")
ppZ0.1 <- plot_grid(ncol=3,align = "hv",
FigList[[paste0(r,"POP")]] + theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"GDP_per_cap")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"GDP_PPP")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Gini")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Emi_CO2")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Emi_Kyo_Gas")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Pol_Cos_GDP_Los_rat")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Prm_Ene")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Fin_Ene")]]+ theme(legend.position="none")+ggtitle("")
)
ppZ1 <- plot_grid(ppZ0.1,p_legend,ncol=1,rel_heights =c(8,0.25),align = "hv") +
draw_plot_label(label = alphabet[1:9], size = 12,y = c(1,1,1,0.69,0.69,0.69,0.38,0.38,0.38), x = c(0, 1/3,2/3,0, 1/3,2/3,0, 1/3,2/3))
ggsave(ppZ1, file=paste0("../output/4paper/ExtFig",r,".png"), dpi = 250, width=12, height=12,limitsize=FALSE)
}
FigList <- list(1)
for(i in nalist){
for(r in c("World",regionaggset,"IND")){
varset <- i
data4plot <- CGEloadfull %>% filter(SceName %in% scenarioset & R %in% r & VEMF %in% varset & Y<= yend  & Y>=ystart & SocEco=="SSP2")%>% left_join(SceOrder)
if(nrow(data4plot)>=1){
if(length(unique(data4plot[data4plot$VEMF==varset,]$SCENARIO))==3){linepalette3 <- linepalette[2:4]}else{linepalette3 <- linepalette}
ylabel <- filter(varlist_load,VEMF==varset)
plot.cge <- ggplot() +
geom_point(data=data4plot,aes(x=Y, y = Value , color=reorder(X=Sceorder,x=SceName)),shape=1,size=3.0,fill="white", position="identity") +
geom_line(data=data4plot,aes(x=Y, y = Value , color=reorder(X=Sceorder,x=SceName)),stat="identity", position="identity")  +
MyThemeLine+ scale_color_manual(values=linepalette3)  +
xlab("Year") + ylab(paste0(ylabel$VName," (",ylabel$Unit,")"))  +  ggtitle(filter(varlist_load,VEMF==varset)[,"VName"]) +
annotate("segment",x=ystart,xend=yend,y=0,yend=0,linetype="dashed",color="grey")+ theme(legend.title=element_blank())
if(r=="World"){ggsave(plot.cge, file=paste0("../output/png/World_",varset,".png"), dpi = 150, width=4, height=4,limitsize=FALSE)}
plot.cgeList <- list(plot.cge)
names(plot.cgeList) <- paste0(r,i)
FigList <- c(FigList,plot.cgeList)
}
}
data4plot <- CGEloadfull %>% filter(SceName %in% c("Baseline") & R %in% regionaggset & VEMF %in% varset & Y>=ystart & Y<=yend & SocEco=="SSP2") %>% inner_join(R5Name,by="R")
plot.cge2[[i]] <- ggplot() +
geom_line(data=data4plot,aes(x=Y, y = Value , color=Rname),stat="identity", position="identity") +
geom_point(data=data4plot,aes(x=Y, y = Value , color=Rname),shape=1,size=3.0,fill="white", position="identity") +
MyThemeLine+ scale_color_manual(values=linepalette3)  + theme(legend.position = "none") +
xlab("Year") + ylab(paste0(filter(varlist_load,VEMF==varset)[,"VName"]," (",filter(varlist_load,VEMF==varset)[,"Unit"],")"))  +  ggtitle(filter(varlist_load,VEMF==varset)[,"VName"]) +
annotate("segment",x=ystart,xend=yend,y=0,yend=0,linetype="dashed",color="grey")+ theme(legend.title=element_blank())
outname <- paste0("../output/png/region_",varset,".png")
ggsave(plot.cge2[[i]], file=outname, dpi = 150, width=4, height=4,limitsize=FALSE)
data4plot <- CGEloadfull %>% filter(SceName %in% scenarioset & R=="World" & VEMF %in% varset & Y>=ystart & Y<=2100 & SocEco=="SSP2")%>% left_join(SceOrder)
plot.cge3[[i]] <- ggplot() +
geom_line(data=data4plot,aes(x=Y, y = Value , color=reorder(X=Sceorder,x=SceName)),stat="identity", position="identity") +
geom_point(data=data4plot,aes(x=Y, y = Value , color=reorder(X=Sceorder,x=SceName)),shape=1,size=3.0,fill="white", position="identity") +
MyThemeLine+ scale_color_manual(values=linepalette3)   +
xlab("Year") + ylab(paste0(filter(varlist_load,VEMF==varset)[,"VName"]," (",filter(varlist_load,VEMF==varset)[,"Unit"],")"))  +  ggtitle(filter(varlist_load,VEMF==varset)[,"VName"]) +
annotate("segment",x=ystart,xend=2100,y=0,yend=0,linetype="dashed",color="grey")+ theme(legend.title=element_blank())
outname <- paste0("../output/png/",varset,"_Scenario.png")
ggsave(plot.cge3[[i]], file=outname, dpi = 150, width=4, height=4,limitsize=FALSE)
}
head(Giniload)
Giniload[Giniload$R=="WLD",] <- "World"
View(Giniload)
Giniload <- rgdx.param('../data/Inputdata.gdx','Gini') %>% rename("Value"=Gini,SCENARIO=Ref)%>% mutate(VEMF="Gini") %>% inner_join(varlist_load) %>%
left_join(ScenarioMapPov,by="SCENARIO") %>% filter(SCENARIO %in% as.vector(ScenarioMapPov[,1])) %>% select(SCENARIO,R,VEMF,Y,Value,VName,Unit,SceName,SocEco)
View(Giniload)
Giniload[Giniload$R=="WLD",]$R <- "World"
Giniload <- rgdx.param('../data/Inputdata.gdx','Gini') %>% rename("Value"=Gini,SCENARIO=Ref)%>% mutate(VEMF="Gini") %>% inner_join(varlist_load) %>%
left_join(ScenarioMapPov,by="SCENARIO") %>% filter(SCENARIO %in% as.vector(ScenarioMapPov[,1])) %>% select(SCENARIO,R,VEMF,Y,Value,VName,Unit,SceName,SocEco)
Giniload$R[Giniload$R=="WLD",] <- "World"
Giniload <- rgdx.param('../data/Inputdata.gdx','Gini') %>% rename("Value"=Gini,SCENARIO=Ref)%>% mutate(VEMF="Gini") %>% inner_join(varlist_load) %>%
left_join(ScenarioMapPov,by="SCENARIO") %>% filter(SCENARIO %in% as.vector(ScenarioMapPov[,1])) %>% select(SCENARIO,R,VEMF,Y,Value,VName,Unit,SceName,SocEco)
Giniload$R <- ifelse(Giniload$R=="WLD", "World", Giniload$R)
CGEloadfull <- rbind(CGEload0,Giniload)
CGEloadfull$Y <- as.numeric(levels(CGEloadfull$Y))[CGEloadfull$Y]
FigList <- list(1)
for(i in nalist){
for(r in c("World",regionaggset,"IND")){
varset <- i
data4plot <- CGEloadfull %>% filter(SceName %in% scenarioset & R %in% r & VEMF %in% varset & Y<= yend  & Y>=ystart & SocEco=="SSP2")%>% left_join(SceOrder)
if(nrow(data4plot)>=1){
if(length(unique(data4plot[data4plot$VEMF==varset,]$SCENARIO))==3){linepalette3 <- linepalette[2:4]}else{linepalette3 <- linepalette}
ylabel <- filter(varlist_load,VEMF==varset)
plot.cge <- ggplot() +
geom_point(data=data4plot,aes(x=Y, y = Value , color=reorder(X=Sceorder,x=SceName)),shape=1,size=3.0,fill="white", position="identity") +
geom_line(data=data4plot,aes(x=Y, y = Value , color=reorder(X=Sceorder,x=SceName)),stat="identity", position="identity")  +
MyThemeLine+ scale_color_manual(values=linepalette3)  +
xlab("Year") + ylab(paste0(ylabel$VName," (",ylabel$Unit,")"))  +  ggtitle(filter(varlist_load,VEMF==varset)[,"VName"]) +
annotate("segment",x=ystart,xend=yend,y=0,yend=0,linetype="dashed",color="grey")+ theme(legend.title=element_blank())
if(r=="World"){ggsave(plot.cge, file=paste0("../output/png/World_",varset,".png"), dpi = 150, width=4, height=4,limitsize=FALSE)}
plot.cgeList <- list(plot.cge)
names(plot.cgeList) <- paste0(r,i)
FigList <- c(FigList,plot.cgeList)
}
}
data4plot <- CGEloadfull %>% filter(SceName %in% c("Baseline") & R %in% regionaggset & VEMF %in% varset & Y>=ystart & Y<=yend & SocEco=="SSP2") %>% inner_join(R5Name,by="R")
plot.cge2[[i]] <- ggplot() +
geom_line(data=data4plot,aes(x=Y, y = Value , color=Rname),stat="identity", position="identity") +
geom_point(data=data4plot,aes(x=Y, y = Value , color=Rname),shape=1,size=3.0,fill="white", position="identity") +
MyThemeLine+ scale_color_manual(values=linepalette3)  + theme(legend.position = "none") +
xlab("Year") + ylab(paste0(filter(varlist_load,VEMF==varset)[,"VName"]," (",filter(varlist_load,VEMF==varset)[,"Unit"],")"))  +  ggtitle(filter(varlist_load,VEMF==varset)[,"VName"]) +
annotate("segment",x=ystart,xend=yend,y=0,yend=0,linetype="dashed",color="grey")+ theme(legend.title=element_blank())
outname <- paste0("../output/png/region_",varset,".png")
ggsave(plot.cge2[[i]], file=outname, dpi = 150, width=4, height=4,limitsize=FALSE)
data4plot <- CGEloadfull %>% filter(SceName %in% scenarioset & R=="World" & VEMF %in% varset & Y>=ystart & Y<=2100 & SocEco=="SSP2")%>% left_join(SceOrder)
plot.cge3[[i]] <- ggplot() +
geom_line(data=data4plot,aes(x=Y, y = Value , color=reorder(X=Sceorder,x=SceName)),stat="identity", position="identity") +
geom_point(data=data4plot,aes(x=Y, y = Value , color=reorder(X=Sceorder,x=SceName)),shape=1,size=3.0,fill="white", position="identity") +
MyThemeLine+ scale_color_manual(values=linepalette3)   +
xlab("Year") + ylab(paste0(filter(varlist_load,VEMF==varset)[,"VName"]," (",filter(varlist_load,VEMF==varset)[,"Unit"],")"))  +  ggtitle(filter(varlist_load,VEMF==varset)[,"VName"]) +
annotate("segment",x=ystart,xend=2100,y=0,yend=0,linetype="dashed",color="grey")+ theme(legend.title=element_blank())
outname <- paste0("../output/png/",varset,"_Scenario.png")
ggsave(plot.cge3[[i]], file=outname, dpi = 150, width=4, height=4,limitsize=FALSE)
}
#X?? Regional Scenarios
for(r in c("World",regionaggset,"IND")){
p_legend <- gtable::gtable_filter(ggplotGrob(FigList[[paste0(r,"POP")]]+ theme(legend.position="bottom")), pattern = "guide-box")
ppZ0.1 <- plot_grid(ncol=3,align = "hv",
FigList[[paste0(r,"POP")]] + theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"GDP_per_cap")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"GDP_PPP")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Gini")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Emi_CO2")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Emi_Kyo_Gas")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Pol_Cos_GDP_Los_rat")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Prm_Ene")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Fin_Ene")]]+ theme(legend.position="none")+ggtitle("")
)
ppZ1 <- plot_grid(ppZ0.1,p_legend,ncol=1,rel_heights =c(8,0.25),align = "hv") +
draw_plot_label(label = alphabet[1:9], size = 12,y = c(1,1,1,0.69,0.69,0.69,0.38,0.38,0.38), x = c(0, 1/3,2/3,0, 1/3,2/3,0, 1/3,2/3))
ggsave(ppZ1, file=paste0("../output/4paper/ExtFig",r,".png"), dpi = 250, width=12, height=12,limitsize=FALSE)
}
View(CGEloadfull)
i <- "Gini"
r
FigList[[paste0("World","Gini")]]
FigList[[paste0(r,"Gini")]]
c("World",regionaggset,"IND")
FigList <- list(1)
for(i in nalist){
for(r in c("World",regionaggset,"IND")){
varset <- i
data4plot <- CGEloadfull %>% filter(SceName %in% scenarioset & R %in% r & VEMF %in% varset & Y<= yend  & Y>=ystart & SocEco=="SSP2")%>% left_join(SceOrder)
if(nrow(data4plot)>=1){
if(length(unique(data4plot[data4plot$VEMF==varset,]$SCENARIO))==3){linepalette3 <- linepalette[2:4]}else{linepalette3 <- linepalette}
ylabel <- filter(varlist_load,VEMF==varset)
plot.cge <- ggplot() +
geom_point(data=data4plot,aes(x=Y, y = Value , color=reorder(X=Sceorder,x=SceName)),shape=1,size=3.0,fill="white", position="identity") +
geom_line(data=data4plot,aes(x=Y, y = Value , color=reorder(X=Sceorder,x=SceName)),stat="identity", position="identity")  +
MyThemeLine+ scale_color_manual(values=linepalette3)  +
xlab("Year") + ylab(paste0(ylabel$VName," (",ylabel$Unit,")"))  +  ggtitle(filter(varlist_load,VEMF==varset)[,"VName"]) +
annotate("segment",x=ystart,xend=yend,y=0,yend=0,linetype="dashed",color="grey")+ theme(legend.title=element_blank())
if(r=="World"){ggsave(plot.cge, file=paste0("../output/png/World_",varset,".png"), dpi = 150, width=4, height=4,limitsize=FALSE)}
plot.cgeList <- list(plot.cge)
names(plot.cgeList) <- paste0(r,i)
FigList <- c(FigList,plot.cgeList)
}
}
data4plot <- CGEloadfull %>% filter(SceName %in% c("Baseline") & R %in% regionaggset & VEMF %in% varset & Y>=ystart & Y<=yend & SocEco=="SSP2") %>% inner_join(R5Name,by="R")
plot.cge2[[i]] <- ggplot() +
geom_line(data=data4plot,aes(x=Y, y = Value , color=Rname),stat="identity", position="identity") +
geom_point(data=data4plot,aes(x=Y, y = Value , color=Rname),shape=1,size=3.0,fill="white", position="identity") +
MyThemeLine+ scale_color_manual(values=linepalette3)  + theme(legend.position = "none") +
xlab("Year") + ylab(paste0(filter(varlist_load,VEMF==varset)[,"VName"]," (",filter(varlist_load,VEMF==varset)[,"Unit"],")"))  +  ggtitle(filter(varlist_load,VEMF==varset)[,"VName"]) +
annotate("segment",x=ystart,xend=yend,y=0,yend=0,linetype="dashed",color="grey")+ theme(legend.title=element_blank())
outname <- paste0("../output/png/region_",varset,".png")
ggsave(plot.cge2[[i]], file=outname, dpi = 150, width=4, height=4,limitsize=FALSE)
data4plot <- CGEloadfull %>% filter(SceName %in% scenarioset & R=="World" & VEMF %in% varset & Y>=ystart & Y<=2100 & SocEco=="SSP2")%>% left_join(SceOrder)
plot.cge3[[i]] <- ggplot() +
geom_line(data=data4plot,aes(x=Y, y = Value , color=reorder(X=Sceorder,x=SceName)),stat="identity", position="identity") +
geom_point(data=data4plot,aes(x=Y, y = Value , color=reorder(X=Sceorder,x=SceName)),shape=1,size=3.0,fill="white", position="identity") +
MyThemeLine+ scale_color_manual(values=linepalette3)   +
xlab("Year") + ylab(paste0(filter(varlist_load,VEMF==varset)[,"VName"]," (",filter(varlist_load,VEMF==varset)[,"Unit"],")"))  +  ggtitle(filter(varlist_load,VEMF==varset)[,"VName"]) +
annotate("segment",x=ystart,xend=2100,y=0,yend=0,linetype="dashed",color="grey")+ theme(legend.title=element_blank())
outname <- paste0("../output/png/",varset,"_Scenario.png")
ggsave(plot.cge3[[i]], file=outname, dpi = 150, width=4, height=4,limitsize=FALSE)
}
#X?? Regional Scenarios
for(r in c("World",regionaggset,"IND")){
p_legend <- gtable::gtable_filter(ggplotGrob(FigList[[paste0(r,"POP")]]+ theme(legend.position="bottom")), pattern = "guide-box")
ppZ0.1 <- plot_grid(ncol=3,align = "hv",
FigList[[paste0(r,"POP")]] + theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"GDP_per_cap")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"GDP_PPP")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Gini")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Emi_CO2")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Emi_Kyo_Gas")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Pol_Cos_GDP_Los_rat")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Prm_Ene")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Fin_Ene")]]+ theme(legend.position="none")+ggtitle("")
)
ppZ1 <- plot_grid(ppZ0.1,p_legend,ncol=1,rel_heights =c(8,0.25),align = "hv") +
draw_plot_label(label = alphabet[1:9], size = 12,y = c(1,1,1,0.69,0.69,0.69,0.38,0.38,0.38), x = c(0, 1/3,2/3,0, 1/3,2/3,0, 1/3,2/3))
ggsave(ppZ1, file=paste0("../output/4paper/ExtFig",r,".png"), dpi = 250, width=12, height=12,limitsize=FALSE)
}
View(Giniload)
Giniload$R <- ifelse(Giniload$R=="WLD", "World", R)
Giniload <- rgdx.param('../data/Inputdata.gdx','Gini') %>% rename("Value"=Gini,SCENARIO=Ref)%>% mutate(VEMF="Gini") %>% inner_join(varlist_load) %>%
left_join(ScenarioMapPov,by="SCENARIO") %>% filter(SCENARIO %in% as.vector(ScenarioMapPov[,1])) %>% select(SCENARIO,R,VEMF,Y,Value,VName,Unit,SceName,SocEco)
Giniload$R <- ifelse(Giniload$R=="WLD", "World", Giniload$R)
View(Giniload)
Giniload <- rgdx.param('../data/Inputdata.gdx','Gini') %>% rename("Value"=Gini,SCENARIO=Ref)%>% mutate(VEMF="Gini") %>% inner_join(varlist_load) %>%
left_join(ScenarioMapPov,by="SCENARIO") %>% filter(SCENARIO %in% as.vector(ScenarioMapPov[,1])) %>% select(SCENARIO,R,VEMF,Y,Value,VName,Unit,SceName,SocEco)
View(Giniload)
head(Giniload$R)
Giniload <- rgdx.param('../data/Inputdata.gdx','Gini') %>% rename("Value"=Gini,SCENARIO=Ref)%>% mutate(VEMF="Gini") %>% inner_join(varlist_load) %>%
left_join(ScenarioMapPov,by="SCENARIO") %>% filter(SCENARIO %in% as.vector(ScenarioMapPov[,1])) %>% select(SCENARIO,R,VEMF,Y,Value,VName,Unit,SceName,SocEco)
Giniload$R <- ifelse(Giniload$R=="WLD", "World", as.vector(Giniload$R))
head(Giniload$R)
head(Giniload)
CGEloadfull <- rbind(CGEload0,Giniload)
CGEloadfull$Y <- as.numeric(levels(CGEloadfull$Y))[CGEloadfull$Y]
FigList <- list(1)
for(i in nalist){
for(r in c("World",regionaggset,"IND")){
varset <- i
data4plot <- CGEloadfull %>% filter(SceName %in% scenarioset & R %in% r & VEMF %in% varset & Y<= yend  & Y>=ystart & SocEco=="SSP2")%>% left_join(SceOrder)
if(nrow(data4plot)>=1){
if(length(unique(data4plot[data4plot$VEMF==varset,]$SCENARIO))==3){linepalette3 <- linepalette[2:4]}else{linepalette3 <- linepalette}
ylabel <- filter(varlist_load,VEMF==varset)
plot.cge <- ggplot() +
geom_point(data=data4plot,aes(x=Y, y = Value , color=reorder(X=Sceorder,x=SceName)),shape=1,size=3.0,fill="white", position="identity") +
geom_line(data=data4plot,aes(x=Y, y = Value , color=reorder(X=Sceorder,x=SceName)),stat="identity", position="identity")  +
MyThemeLine+ scale_color_manual(values=linepalette3)  +
xlab("Year") + ylab(paste0(ylabel$VName," (",ylabel$Unit,")"))  +  ggtitle(filter(varlist_load,VEMF==varset)[,"VName"]) +
annotate("segment",x=ystart,xend=yend,y=0,yend=0,linetype="dashed",color="grey")+ theme(legend.title=element_blank())
if(r=="World"){ggsave(plot.cge, file=paste0("../output/png/World_",varset,".png"), dpi = 150, width=4, height=4,limitsize=FALSE)}
plot.cgeList <- list(plot.cge)
names(plot.cgeList) <- paste0(r,i)
FigList <- c(FigList,plot.cgeList)
}
}
data4plot <- CGEloadfull %>% filter(SceName %in% c("Baseline") & R %in% regionaggset & VEMF %in% varset & Y>=ystart & Y<=yend & SocEco=="SSP2") %>% inner_join(R5Name,by="R")
plot.cge2[[i]] <- ggplot() +
geom_line(data=data4plot,aes(x=Y, y = Value , color=Rname),stat="identity", position="identity") +
geom_point(data=data4plot,aes(x=Y, y = Value , color=Rname),shape=1,size=3.0,fill="white", position="identity") +
MyThemeLine+ scale_color_manual(values=linepalette3)  + theme(legend.position = "none") +
xlab("Year") + ylab(paste0(filter(varlist_load,VEMF==varset)[,"VName"]," (",filter(varlist_load,VEMF==varset)[,"Unit"],")"))  +  ggtitle(filter(varlist_load,VEMF==varset)[,"VName"]) +
annotate("segment",x=ystart,xend=yend,y=0,yend=0,linetype="dashed",color="grey")+ theme(legend.title=element_blank())
outname <- paste0("../output/png/region_",varset,".png")
ggsave(plot.cge2[[i]], file=outname, dpi = 150, width=4, height=4,limitsize=FALSE)
data4plot <- CGEloadfull %>% filter(SceName %in% scenarioset & R=="World" & VEMF %in% varset & Y>=ystart & Y<=2100 & SocEco=="SSP2")%>% left_join(SceOrder)
plot.cge3[[i]] <- ggplot() +
geom_line(data=data4plot,aes(x=Y, y = Value , color=reorder(X=Sceorder,x=SceName)),stat="identity", position="identity") +
geom_point(data=data4plot,aes(x=Y, y = Value , color=reorder(X=Sceorder,x=SceName)),shape=1,size=3.0,fill="white", position="identity") +
MyThemeLine+ scale_color_manual(values=linepalette3)   +
xlab("Year") + ylab(paste0(filter(varlist_load,VEMF==varset)[,"VName"]," (",filter(varlist_load,VEMF==varset)[,"Unit"],")"))  +  ggtitle(filter(varlist_load,VEMF==varset)[,"VName"]) +
annotate("segment",x=ystart,xend=2100,y=0,yend=0,linetype="dashed",color="grey")+ theme(legend.title=element_blank())
outname <- paste0("../output/png/",varset,"_Scenario.png")
ggsave(plot.cge3[[i]], file=outname, dpi = 150, width=4, height=4,limitsize=FALSE)
}
#X?? Regional Scenarios
for(r in c("World",regionaggset,"IND")){
p_legend <- gtable::gtable_filter(ggplotGrob(FigList[[paste0(r,"POP")]]+ theme(legend.position="bottom")), pattern = "guide-box")
ppZ0.1 <- plot_grid(ncol=3,align = "hv",
FigList[[paste0(r,"POP")]] + theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"GDP_per_cap")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"GDP_PPP")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Gini")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Emi_CO2")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Emi_Kyo_Gas")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Pol_Cos_GDP_Los_rat")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Prm_Ene")]]+ theme(legend.position="none")+ggtitle(""),
FigList[[paste0(r,"Fin_Ene")]]+ theme(legend.position="none")+ggtitle("")
)
ppZ1 <- plot_grid(ppZ0.1,p_legend,ncol=1,rel_heights =c(8,0.25),align = "hv") +
draw_plot_label(label = alphabet[1:9], size = 12,y = c(1,1,1,0.69,0.69,0.69,0.38,0.38,0.38), x = c(0, 1/3,2/3,0, 1/3,2/3,0, 1/3,2/3))
ggsave(ppZ1, file=paste0("../output/4paper/ExtFig",r,".png"), dpi = 250, width=12, height=12,limitsize=FALSE)
}
View(PovIndicator)
#---- World map
world <- map_data("world")
WorldMapRegion <- unique(world$region)
write.table(WorldMapRegion, file = "../define/WorldMapRegion.txt", append = FALSE, row.names=FALSE, quote = TRUE, sep = ",")
WorldMapRegionMap <- read.table("../define/WorldMapRegion.Map", sep="\t",header=T)
worldmapfunction <- function(X1,X3){
SDNData <- X1[X1$R=="SDN",]
SDNData$region <- "South Sudan"
X2 <- rbind(X1,SDNData)
WorldMapdata <- left_join(world,X2,by="region")
g1 <- ggplot(WorldMapdata,aes(x = long, y = lat, group=group, fill = Value)) + geom_polygon(size = 0.25) +
geom_path(aes(x = long, y = lat, group = group),colour = "gray40", size = 0.01) +xlab("")+ylab("")   +
scale_fill_gradient2(low = X3[1], mid = X3[2], high = X3[3], na.value="white", midpoint = as.numeric(X3[4]), name=X3[5]
#  breaks=c(maxv/6,maxv*3/6,maxv*5/6),labels=c("Low","Medium","High"),
) + coord_equal() + scale_x_continuous(breaks=NULL)   +MyThemeLine+
theme(panel.border = element_rect(colour = "white", fill=NA, size=0),axis.text.x = element_blank(),
axis.line = element_line(colour="White"),axis.text.y = element_blank(),axis.ticks = element_blank())+ ylim(-65,80)+ xlim(-160,160) +
theme(plot.margin = margin(0, 0, 0, 0, "cm"),
legend.key.width = unit(1, 'cm'), #change legend key size
#          legend.key.height = unit(0.1, 'cm'), #change legend key height
legend.key.size = unit(1, 'cm'), #change legend key width
legend.title = element_text(size=14), #change legend title font size
legend.text = element_text(size=14)) #change legend text font size
return(g1)
}
scenariolist <- c("1.5C","WB2C","Baseline")
yearlist <- c(2010,2030)
jj <- 1
Indlistpov <- c("PovHeadC","PovRate")
Indlistleg <- c("Population at extreme poverty\n(million)","Population at extreme poverty rate (-)")
Indlistmap <- data.frame(Indlistpov,Indlistleg)
WMlist <- list(1)
for(i in Indlistmap$Indlistpov){
for(yr in yearlist){
for(v in scenariolist){
jj = jj +1
YY <- inner_join(filter(filter(PovIndicator,Ind==i),TH=="pop_1.9" & Y==yr & SceName==v & Model=="Income" & SocEco=="SSP2"),WorldMapRegionMap,by="R")
if(i=="PovHeadC"){YY$Value <- YY$Value/10**6}
mappara <- c("white",OrRdPal[4],OrRdPal[7],max(YY$Value)/2,as.vector(filter(Indlistmap,Indlistpov==i)[,"Indlistleg"]))
WMPovHead <- list(worldmapfunction(YY,mappara) +theme(legend.position="bottom"))
names(WMPovHead) <- c(paste0(i,v,yr))
WMlist <- c(WMlist,WMPovHead)
outname <- paste0("../output/png/Worldmap",i,v,yr,".png")
ggsave(WMlist[[jj]], file=outname, dpi = 250, width=10, height=6,limitsize=FALSE)
#Take difference
}
YY1 <- spread(inner_join(filter(filter(PovIndicator,Ind==i),TH=="pop_1.9" & Y==yr & Model=="Expenditure" & SocEco=="SSP2"),WorldMapRegionMap,by="R") %>% select(-SCENARIO,-Sceorder),key=SceName,value=Value)
YY1$'1.5C' <- YY1$'1.5C'-YY1$'Baseline'
YY1$'WB2C' <- YY1$'WB2C'-YY1$'Baseline'
YY1$'NDC' <- YY1$'NDC'-YY1$'Baseline'
YY2 <- select(YY1,-Baseline) %>% gather(key=SceName,value=Value,'1.5C',WB2C,NDC) %>% left_join(SceOrder)
for(v in scenariolist){
if(v!="Baseline" & yr!=2010){
jj = jj +1
YY <- filter(YY2, SceName==v)
if(i=="PovHeadC"){YY$Value <- YY$Value/10**6}
mappara <- c("white",bluesPal[4],bluesPal[7],max(YY$Value)/2,as.vector(filter(Indlistmap,Indlistpov==i)[,"Indlistleg"]))
WMPovHead <- list(worldmapfunction(YY,mappara) +theme(legend.position="bottom"))
names(WMPovHead) <- c(paste0("Dif",i,v,yr))
WMlist <- c(WMlist,WMPovHead)
outname <- paste0("../output/png/Worldmap_Dif_",i,v,yr,".png")
ggsave(WMlist[[jj]], file=outname, dpi = 250, width=10, height=6,limitsize=FALSE)
}
}
}
}
#X1)Globalmap for 1.5
ppX1 <- plot_grid(WMlist[["PovRateBaseline2030"]],WMlist[["DifPovRate1.5C2030"]],WMlist[["PovHeadCBaseline2030"]],WMlist[["DifPovHeadC1.5C2030"]],ncol=2,align = "hv") +
draw_plot_label(label = alphabet[1:4], size = 12,x = c(0,1/2,0,0.5), y = c(1, 1,0.5,0.5))
ggsave(ppX1, file=paste0("../output/4paper/Xfig1",".png"), dpi = 250, width=12, height=8,limitsize=FALSE)
ggsave(ppX1, file=paste0("../output/vector/Xfig1.svg"), dpi = 250, width=12, height=8,limitsize=FALSE)
scenariolist <- c("1.5C","NDC","WB2C","Baseline")
yearlist <- c(2010,2030)
jj <- 1
Indlistpov <- c("PovHeadC","PovRate")
Indlistleg <- c("Population at extreme poverty\n(million)","Population at extreme poverty rate (-)")
Indlistmap <- data.frame(Indlistpov,Indlistleg)
WMlist <- list(1)
for(i in Indlistmap$Indlistpov){
for(yr in yearlist){
for(v in scenariolist){
jj = jj +1
YY <- inner_join(filter(filter(PovIndicator,Ind==i),TH=="pop_1.9" & Y==yr & SceName==v & Model=="Income" & SocEco=="SSP2"),WorldMapRegionMap,by="R")
if(i=="PovHeadC"){YY$Value <- YY$Value/10**6}
mappara <- c("white",OrRdPal[4],OrRdPal[7],max(YY$Value)/2,as.vector(filter(Indlistmap,Indlistpov==i)[,"Indlistleg"]))
WMPovHead <- list(worldmapfunction(YY,mappara) +theme(legend.position="bottom"))
names(WMPovHead) <- c(paste0(i,v,yr))
WMlist <- c(WMlist,WMPovHead)
outname <- paste0("../output/png/Worldmap",i,v,yr,".png")
ggsave(WMlist[[jj]], file=outname, dpi = 250, width=10, height=6,limitsize=FALSE)
#Take difference
}
YY1 <- spread(inner_join(filter(filter(PovIndicator,Ind==i),TH=="pop_1.9" & Y==yr & Model=="Expenditure" & SocEco=="SSP2"),WorldMapRegionMap,by="R") %>% select(-SCENARIO,-Sceorder),key=SceName,value=Value)
YY1$'1.5C' <- YY1$'1.5C'-YY1$'Baseline'
YY1$'WB2C' <- YY1$'WB2C'-YY1$'Baseline'
YY1$'NDC' <- YY1$'NDC'-YY1$'Baseline'
YY2 <- select(YY1,-Baseline) %>% gather(key=SceName,value=Value,'1.5C',WB2C,NDC) %>% left_join(SceOrder)
for(v in scenariolist){
if(v!="Baseline" & yr!=2010){
jj = jj +1
YY <- filter(YY2, SceName==v)
if(i=="PovHeadC"){YY$Value <- YY$Value/10**6}
mappara <- c("white",bluesPal[4],bluesPal[7],max(YY$Value)/2,as.vector(filter(Indlistmap,Indlistpov==i)[,"Indlistleg"]))
WMPovHead <- list(worldmapfunction(YY,mappara) +theme(legend.position="bottom"))
names(WMPovHead) <- c(paste0("Dif",i,v,yr))
WMlist <- c(WMlist,WMPovHead)
outname <- paste0("../output/png/Worldmap_Dif_",i,v,yr,".png")
ggsave(WMlist[[jj]], file=outname, dpi = 250, width=10, height=6,limitsize=FALSE)
}
}
}
}
#X1)Globalmap for 1.5
ppX1 <- plot_grid(WMlist[["DifPovRate1.5C2030"]],WMlist[["DifPovRateNDC2030"]],WMlist[["DifPovHeadC1.5C2030"]],WMlist[["DifPovHeadCNDC2030"]],ncol=2,align = "hv") +
draw_plot_label(label = alphabet[1:4], size = 12,x = c(0,1/2,0,0.5), y = c(1, 1,0.5,0.5))
ggsave(ppX1, file=paste0("../output/4paper/Xfig1",".png"), dpi = 250, width=12, height=8,limitsize=FALSE)
ggsave(ppX1, file=paste0("../output/vector/Xfig1.svg"), dpi = 250, width=12, height=8,limitsize=FALSE)
#X1)Globalmap for 1.5
ppX1 <- plot_grid(WMlist[["DifPovRate1.5C2030"]],WMlist[["DifPovHeadC1.5C2030"]],ncol=2,align = "hv") +
draw_plot_label(label = alphabet[1:2], size = 12,x = c(0,1/2), y = c(1, 1))
ggsave(ppX1, file=paste0("../output/4paper/Xfig1",".png"), dpi = 250, width=12, height=4,limitsize=FALSE)
ggsave(ppX1, file=paste0("../output/vector/Xfig1.svg"), dpi = 250, width=12, height=4,limitsize=FALSE)
#X2)Decomposition country
p_legend <- gtable::gtable_filter(ggplotGrob(DecomList[["absWB2C"]]+ theme(legend.position="bottom")), pattern = "guide-box")
ppX1 <- plot_grid(DecomList[["absWB2C"]] + theme(legend.position="none"),DecomList[["shareWB2C"]] + theme(legend.position="none")+ylab("Share (-)"),
DecomList[["abs1.5C"]] + theme(legend.position="none"),DecomList[["share1.5C"]] + theme(legend.position="none")+ylab("Share (-)"),ncol=1,align = "hv")
ppX1.1 <- plot_grid(ppX1,p_legend,ncol=1,rel_heights =c(8,0.5),align = "hv") +
draw_plot_label(label = alphabet[1:4], size = 12,x = c(0,0,0,0), y = c(1, 0.77,0.54,0.28))
ggsave(ppX1.1, file=paste0("../output/4paper/ExtFig_CountryDec",".png"), dpi = 250, width=10, height=15,limitsize=FALSE)
ggsave(ppX1.1, file=paste0("../output/vector/ExtFig_CountryDec.svg"), dpi = 250, width=10, height=15,limitsize=FALSE)
r
plot.dist[["R5ASIA"]]
p_legend <- gtable::gtable_filter(ggplotGrob(plot.dist[["R5ASIA"]]), pattern = "guide-box")
ppX1 <- plot_grid(plot.dist[["World"]] + theme(legend.position="none"),plot.dist[["R5OECD+EU"]] + theme(legend.position="none"),
plot.dist[["R5MAF"]] + theme(legend.position="none"),plot.dist[["R5ASIA"]] + theme(legend.position="none"),
plot.dist[["R5LAM"]] + theme(legend.position="none"),plot.dist[["R5REF"]] + theme(legend.position="none"),
ncol=2,align = "hv") +
draw_plot_label(label = alphabet[1:6], size = 12,x = c(0,0.5,0,0.5,0,0.5), y = c(1, 1,2/3,2/3,1/3,1/3))
ggsave(ppX1.1, file=paste0("../output/4paper/ExtFig_Distribution",".png"), dpi = 250, width=10, height=15,limitsize=FALSE)
ggsave(ppX1.1, file=paste0("../output/vector/ExtFig_Distribution.svg"), dpi = 250, width=10, height=15,limitsize=FALSE)
ggsave(ppX1, file=paste0("../output/4paper/ExtFig_Distribution",".png"), dpi = 250, width=10, height=15,limitsize=FALSE)
ggsave(ppX1, file=paste0("../output/vector/ExtFig_Distribution.svg"), dpi = 250, width=10, height=15,limitsize=FALSE)
ppX1 <- plot_grid(plot.dist[["World"]] + theme(legend.position="none"),plot.dist[["R5OECD+EU"]] + theme(legend.position="none"),
plot.dist[["R5MAF"]] + theme(legend.position="none"),plot.dist[["R5ASIA"]] + theme(legend.position="none"),
plot.dist[["R5LAM"]] + theme(legend.position="none"),plot.dist[["R5REF"]] + theme(legend.position="none"),
ncol=3,align = "hv")
ppX1.1 <- plot_grid(ppX1,p_legend,ncol=1,rel_heights =c(8,0.5),align = "hv") +
draw_plot_label(label = alphabet[1:6], size = 12,x = c(0,0.5,0,0.5,0,0.5), y = c(1, 1,2/3,2/3,1/3,1/3))
ggsave(ppX1, file=paste0("../output/4paper/ExtFig_Distribution",".png"), dpi = 250, width=10, height=15,limitsize=FALSE)
ggsave(ppX1, file=paste0("../output/vector/ExtFig_Distribution.svg"), dpi = 250, width=10, height=15,limitsize=FALSE)
ppX1 <- plot_grid(plot.dist[["World"]] + theme(legend.position="none"),plot.dist[["R5OECD90+EU"]] + theme(legend.position="none"),
plot.dist[["R5MAF"]] + theme(legend.position="none"),plot.dist[["R5ASIA"]] + theme(legend.position="none"),
plot.dist[["R5LAM"]] + theme(legend.position="none"),plot.dist[["R5REF"]] + theme(legend.position="none"),
ncol=3,align = "hv")
ppX1.1 <- plot_grid(ppX1,p_legend,ncol=1,rel_heights =c(8,0.5),align = "hv") +
draw_plot_label(label = alphabet[1:6], size = 12,x = c(0,0.5,0,0.5,0,0.5), y = c(1, 1,2/3,2/3,1/3,1/3))
ggsave(ppX1, file=paste0("../output/4paper/ExtFig_Distribution",".png"), dpi = 250, width=10, height=15,limitsize=FALSE)
ggsave(ppX1, file=paste0("../output/vector/ExtFig_Distribution.svg"), dpi = 250, width=10, height=15,limitsize=FALSE)
ppX1 <- plot_grid(plot.dist[["R5OECD90+EU"]] + theme(legend.position="none"),
plot.dist[["R5MAF"]] + theme(legend.position="none"),plot.dist[["R5ASIA"]] + theme(legend.position="none"),
plot.dist[["R5LAM"]] + theme(legend.position="none"),plot.dist[["R5REF"]] + theme(legend.position="none"),
ncol=3,align = "hv")
ppX1.1 <- plot_grid(ppX1,p_legend,ncol=1,rel_heights =c(8,0.5),align = "hv") +
draw_plot_label(label = alphabet[1:6], size = 12,x = c(0,1/3,2/3,0,1/3,), y = c(1, 1,1,0.5,0.5))
ppX1.1 <- plot_grid(ppX1,p_legend,ncol=1,rel_heights =c(8,0.5),align = "hv") +
draw_plot_label(label = alphabet[1:6], size = 12,x = c(0,1/3,2/3,0,1/3), y = c(1, 1,1,0.5,0.5))
ppX1.1 <- plot_grid(ppX1,p_legend,ncol=1,rel_heights =c(8,0.5),align = "hv") +
draw_plot_label(label = alphabet[1:5], size = 12,x = c(0,1/3,2/3,0,1/3), y = c(1, 1,1,0.5,0.5))
ppX1.1 <- plot_grid(ppX1,p_legend,ncol=1,rel_heights =c(8,0.5),align = "hv") +
draw_plot_label(label = alphabet[1:5], size = 12,x = c(0,1/3,2/3,0,1/3), y = c(1, 1,1,0.5,0.5))
ggsave(ppX1.1, file=paste0("../output/4paper/ExtFig_Distribution",".png"), dpi = 250, width=10, height=15,limitsize=FALSE)
ggsave(ppX1.1, file=paste0("../output/vector/ExtFig_Distribution.svg"), dpi = 250, width=10, height=15,limitsize=FALSE)
p_legend <- gtable::gtable_filter(ggplotGrob(plot.dist[["R5ASIA"]]+ theme(legend.position="bottom")), pattern = "guide-box")
ppX1 <- plot_grid(plot.dist[["R5OECD90+EU"]] + theme(legend.position="none"),
plot.dist[["R5MAF"]] + theme(legend.position="none"),plot.dist[["R5ASIA"]] + theme(legend.position="none"),
plot.dist[["R5LAM"]] + theme(legend.position="none"),plot.dist[["R5REF"]] + theme(legend.position="none"),
ncol=3,align = "hv")
p_legend <- gtable::gtable_filter(ggplotGrob(plot.dist[["R5ASIA"]]+ theme(legend.position="bottom")), pattern = "guide-box")
ppX1 <- plot_grid(plot.dist[["R5OECD90+EU"]] + theme(legend.position="none"),
plot.dist[["R5MAF"]] + theme(legend.position="none"),plot.dist[["R5ASIA"]] + theme(legend.position="none"),
plot.dist[["R5LAM"]] + theme(legend.position="none"),plot.dist[["R5REF"]] + theme(legend.position="none"),
ncol=3,align = "hv")
ppX1.1 <- plot_grid(ppX1,p_legend,ncol=1,rel_heights =c(8,0.5),align = "hv") +
draw_plot_label(label = alphabet[1:5], size = 12,x = c(0,1/3,2/3,0,1/3), y = c(1, 1,1,0.5,0.5))
ggsave(ppX1.1, file=paste0("../output/4paper/ExtFig_Distribution",".png"), dpi = 250, width=10, height=6,limitsize=FALSE)
ggsave(ppX1.1, file=paste0("../output/vector/ExtFig_Distribution.svg"), dpi = 250, width=10, height=6,limitsize=FALSE)
ppX1 <- plot_grid(plot.dist[["R5OECD90+EU"]] + theme(legend.position="none")+xlab("Expenditure per capita (2011International$PPP/cap)"),
plot.dist[["R5MAF"]] + theme(legend.position="none")+xlab("Expenditure per capita (2011International$PPP/cap)"),plot.dist[["R5ASIA"]] + theme(legend.position="none")+xlab("Expenditure per capita (2011International$PPP/cap)"),
plot.dist[["R5LAM"]] + theme(legend.position="none")+xlab("Expenditure per capita (2011International$PPP/cap)"),plot.dist[["R5REF"]] + theme(legend.position="none")+xlab("Expenditure per capita (2011International$PPP/cap)"),
ncol=3,align = "hv")
ppX1.1 <- plot_grid(ppX1,p_legend,ncol=1,rel_heights =c(8,0.5),align = "hv") +
draw_plot_label(label = alphabet[1:5], size = 12,x = c(0,1/3,2/3,0,1/3), y = c(1, 1,1,0.5,0.5))
ggsave(ppX1.1, file=paste0("../output/4paper/ExtFig_Distribution",".png"), dpi = 250, width=10, height=6,limitsize=FALSE)
ggsave(ppX1.1, file=paste0("../output/vector/ExtFig_Distribution.svg"), dpi = 250, width=10, height=6,limitsize=FALSE)
ggsave(ppX1.1, file=paste0("../output/4paper/ExtFig_Distribution",".png"), dpi = 250, width=12, height=6,limitsize=FALSE)
ppX1.1 <- plot_grid(ppX1,p_legend,ncol=1,rel_heights =c(8,0.5),align = "hv") +
draw_plot_label(label = alphabet[1:5], size = 12,x = c(0,1/3,2/3,0,1/3), y = c(1, 1,1,0.55,0.55))
ggsave(ppX1.1, file=paste0("../output/4paper/ExtFig_Distribution",".png"), dpi = 250, width=15, height=8,limitsize=FALSE)
